package com.imti.mall.sale.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.imti.mall.model.sms.pojo.SmsHomeRecommendProduct;
import com.imti.mall.model.sms.vo.SmsHomeRecommendProductPicVo;
import com.imti.mall.sale.dao.SmsHomeRecommendProductDao;
import com.imti.mall.sale.service.SmsHomeRecommendProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class SmsHomeRecommendProductServiceImpl extends ServiceImpl<SmsHomeRecommendProductDao, SmsHomeRecommendProduct> implements SmsHomeRecommendProductService {

    @Autowired
    SmsHomeRecommendProductDao smsHomeRecommendProductDao;
    /**
     * 查询人气推荐商品表
     */
    @Override
    public List<SmsHomeRecommendProduct> findSmsHomeRecommendProduct(SmsHomeRecommendProduct smsHomeRecommendProduct ,Integer pageSize, Integer pageNum) {
        PageHelper.startPage(pageNum, pageSize);
        return smsHomeRecommendProductDao.findSmsHomeRecommendProduct(smsHomeRecommendProduct);
    }
    /**
     * 修改人气推荐商品表
     * @param smsHomeRecommendProduct
     * @return
     */
    @Override
    public Integer updateSmsHomeRecommendProduct(SmsHomeRecommendProduct smsHomeRecommendProduct) {
        return smsHomeRecommendProductDao.updateSmsHomeRecommendProduct(smsHomeRecommendProduct);
    }
    /**
     * 根据id删除人气推荐商品
     * @param id
     * @return
     *
     */
    @Override
    public Integer delSmsHomeRecommendProduct(Integer id) {
        return smsHomeRecommendProductDao.deleteById(id);
    }
    /**
     * 添加人气推荐商品
     * @param smsHomeRecommendProduct
     * @return
     */
    @Override
    public Integer addSmsHomeRecommendProduct(SmsHomeRecommendProduct smsHomeRecommendProduct) {
        return smsHomeRecommendProductDao.insert(smsHomeRecommendProduct);
    }
    /**
     * 人气商品图片价位
     * @param smsHomeRecommendProductPicVo
     * @return
     */
    @Override
    public List<SmsHomeRecommendProductPicVo> findSmsHomeRecommendProductPic(SmsHomeRecommendProductPicVo smsHomeRecommendProductPicVo) {
        return smsHomeRecommendProductDao.findSmsHomeRecommendProductPic(smsHomeRecommendProductPicVo);
    }
}
